import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.Tag;
import java.io.IOException;

public class HelloTag implements Tag {
    PageContext pageContext;

    @Override
    public int doEndTag() throws JspException {
        System.out.println("end");
        try {
            pageContext.getOut().write("hello world");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return Tag.EVAL_PAGE;
    }


    @Override
    public int doStartTag() throws JspException {
        System.out.println("start");
        return Tag.SKIP_BODY;
    }


    @Override
    public void setPageContext(PageContext pc) {
        pageContext = pc;
    }

    @Override
    public void setParent(Tag tag) {

    }

    @Override
    public Tag getParent() {
        return null;
    }



    @Override
    public void release() {

    }
}
